home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 8 / Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO / 034a / aecur101.arj / CONTRIB / CURSES / SRC / MARKWIN.C < prev    next >
C/C++ Source or Header  |  1990-03-08  |  1KB  |  74 lines

  1. /*------------------------------------------------------------
  2.  * 
  3.  *  markwin.c
  4.  * 
  5.  *  copyright (c) 1987,88,89,90 J. Alan Eldridge
  6.  *
  7.  *  used internally by curses
  8.  * 
  9.  *  mark and unmark a windows dirty region
  10.  * 
  11.  *----------------------------------------------------------*/
  12.  
  13. #include "curses.h"
  14.  
  15. void
  16. markwin(win)
  17. WINDOW *win;
  18. {
  19.     int cy, cx;
  20.     
  21.     getyx(win,cy,cx);
  22.  
  23.     if (cy > win->lasty) 
  24.         win->lasty = cy;
  25.  
  26.     if (cy < win->firsty) 
  27.         win->firsty = cy;
  28.  
  29.     if (cx < win->firstx[cy])
  30.         win->firstx[cy] = cx;
  31.     if (cx > win->lastx[cy])
  32.         win->lastx[cy] = cx;
  33.         
  34.     win->flags |= _WDIRTY;
  35. }
  36.  
  37. void
  38. umarkwin(win)
  39. WINDOW *win;
  40. {
  41.     int y, maxy;
  42.     
  43.     maxy = getmaxr(win);
  44.     
  45.     win->firsty = INT_MAX;
  46.     win->lasty = -1;
  47.  
  48.     for (y = 0; y <= maxy; y++) {
  49.         win->firstx[y] = INT_MAX;
  50.         win->lastx[y] = -1;
  51.     }
  52.  
  53.     win->flags &= ~_WDIRTY;
  54. }
  55.  
  56. void
  57. touchwin(win)
  58. WINDOW *win;
  59. {
  60.     int y, maxy, maxx;
  61.     
  62.     getmaxrc(win, maxy, maxx);
  63.     
  64.     win->firsty = 0;
  65.     win->lasty = win->maxy;
  66.  
  67.     for (y = 0; y < maxy; y++) {
  68.         win->firstx[y] = 0;
  69.         win->lastx[y] = maxx;
  70.     }
  71.     
  72.     win->flags |= _WDIRTY;
  73. }
  74.